import React ,{Component} from "react"
import {StyleSheet,Text,TouchableOpacity} from "react-native"
import {Actions} from "react-native-router-flux"
import {connect} from "react-redux";
import Resolution from "../../tools/Resolution"

import sAdapter from '../../tools/screenAdapter'

class AlertModal extends Component{
    constructor(props) {
        super(props);
        this.state = {
            msg:""
        };
    }

    componentDidMount(): void {
        this.timer = setTimeout(()=>{
            Actions.pop();
        },500)
    }

    componentWillUnmount(): void {

        clearInterval(this.timer)

    }

    render(): React.ReactNode {
        return <Resolution.FixWidthViewModal style={styles.container}>

            <TouchableOpacity  style={styles.content}>
                <Text style={styles.text}>{this.props.msg}</Text>
            </TouchableOpacity>
        </Resolution.FixWidthViewModal>

    }

}

var styles = StyleSheet.create({
    container:{
        backgroundColor: "rgba(0,0,0,1)",
        position:"absolute",
        top:0,
        left:0,
        opacity:0
    },
    content:{
        flex:1,
        backgroundColor: 'rgba(0,0,0,0.1)',
    },
    text:{
        fontSize:32,
        textAlign: "center",
        lineHeight:64,
        marginTop:500,
        marginLeft:"auto",
        marginRight:"auto",
        backgroundColor:"#fff",
        paddingLeft:30,
        paddingRight:30,
        borderRadius:6
    },

    page:{
        position:"absolute",
        top:0,
        left:0,
        height: sAdapter.height,
        width: sAdapter.width,
        transform:sAdapter.transform,
        backgroundColor: "rgba(0,0,0,0.2)",
    }

});

export default connect(
    (state) => {
        return {
        }
    },
    (dispatch) => ({

    })
)(AlertModal)